{% extends "admin.html" %}

Upload File Manager 

{% block jsfuncs %}

SplitFile = function() 
{
	var file = $("upfile").value;
	file = file.replace(/\\/g, "/");
	var parts = file.split("/");
	var filename = parts[parts.length - 1];

	var bits = filename.split(".");
	
	$('file_form').getElementById('filename').setAttribute('value',filename);
	return true;
}

{% endblock %}

{% block content %}
<!-- {{{ file list -->
<form action="/admin/codemanager" method="post">
<table>
	<tr>
		<th>插件名称</th>
		<th>文件大小</th>
		<th>上传时间</th>
		<th>删除</th>
		<th>激活</th>
	</tr>
{% for file in files %}
	<tr>
		<td><a href="/upload/{{ file.name }}">{{ file.orig_name|escape }}</a></td>
		<td align="right">{{ file.data|length }}</td>
		<td>{{ file.date|date:"Y-m-d H:i:s" }}</td>
		<td><input type="checkbox" name="del" value="{{ file.key.id }}" /></td>
		<td><input type="checkbox" {% if file.active %} checked="true"{% endif %} name="act" value="{{ file.key.id }}" /></td>
	</tr>
{% endfor %}
	<tr>
		<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td colspan="2" align="right">
			<input type="submit" value="执行插件激活和删除操作" onclick="return confirm('确认执行该操作?');" />
		</td>
	</tr>
</table>
</form>
<!-- }}} -->
<br />
<strong>上传一个文件</strong>
<!-- {{{ file upload -->
<form action="/admin/uploadcode" method="post" enctype="multipart/form-data" id="file_form" accept-charset="utf-8">
	<input type="file" id="upfile" name="upfile" />
	<input type="hidden" id="filename" name="filename" />
	<input type="submit" value="上传" onclick="return SplitFile();"/><img src="/static/images/loading.gif" style="display:none;" id="load_img" />
</form>
<!-- }}} -->
{% endblock %}
